package com.huawei.updatesdk.service.otaupdate;

import com.huawei.updatesdk.a.b.d.a.c;
import com.huawei.updatesdk.a.b.d.a.d;
import com.huawei.updatesdk.service.appmgr.bean.ApkUpgradeInfo;
import com.huawei.updatesdk.service.appmgr.bean.b;
import java.util.List;

public class e {
    private static String a = "com.huawei.appmarket";
    private static b b;

    static class a implements com.huawei.updatesdk.a.b.d.a.a {
        private a() {
        }

        public void a(c cVar, d dVar) {
        }

        public void b(c cVar, d dVar) {
            if (dVar instanceof b) {
                b bVar = (b) dVar;
                if (dVar.a() == 0 && dVar.b() == 0) {
                    if ((bVar.list_ != null && bVar.list_.size() != 0) || (bVar.notRcmList_ != null && bVar.notRcmList_.size() != 0)) {
                        ApkUpgradeInfo a = e.b(bVar.list_);
                        if (e.b != null) {
                            e.b.a(a);
                        }
                    } else if (e.b != null) {
                        e.b.a(dVar.a());
                    }
                } else if (e.b != null) {
                    e.b.b(dVar.a());
                }
            } else if (e.b != null) {
                e.b.a(dVar.a());
            }
        }
    }

    public static void a(b bVar) {
        b = bVar;
    }

    public static void a(String str) {
        a = str;
        com.huawei.updatesdk.service.d.a.c.a(com.huawei.updatesdk.service.appmgr.bean.a.d(a), new a());
    }

    private static ApkUpgradeInfo b(List<ApkUpgradeInfo> list) {
        if (list == null) {
            return null;
        }
        for (ApkUpgradeInfo apkUpgradeInfo : list) {
            if (a != null && a.equals(apkUpgradeInfo.getPackage_())) {
                break;
            }
        }
        ApkUpgradeInfo apkUpgradeInfo2 = null;
        return apkUpgradeInfo2;
    }
}
